/*
 * Flashlib - QB9 common Flash library
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

 
package com.qb9.flashlib.net
{
	import flash.display.Loader;
	import flash.events.Event;
	import flash.net.URLRequest;

	/** Wrapper for the Loader class that implements the ILoader interface. */
	internal class QLoader extends Loader implements ILoader
	{
		protected var _dataFormat:String;
		
		public function QLoader()
		{
		}
		
		public function loadURL(url:URLRequest):void
		{
			load(url);
		}
		
		public function getData() : *
		{
			return contentLoaderInfo.content;
		}
		
		public function getBytesLoaded():uint
		{
			return contentLoaderInfo.bytesLoaded;
		}
		
		public function getBytesTotal():uint
		{
			return contentLoaderInfo.bytesTotal;
		}
		
		public function getDataFormat():String
		{
			return _dataFormat;
		}
		
		public function setDataFormat(format:String):void
		{
			_dataFormat = format;
		}
		
		public override function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void
		{
			contentLoaderInfo.addEventListener(type, listener, useCapture, priority, useWeakReference);
		}
		
		public override function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void
		{
			contentLoaderInfo.removeEventListener(type, listener, useCapture);
		}
		
		public override function dispatchEvent(event:Event):Boolean
		{
			return contentLoaderInfo.dispatchEvent(event);
		}
		
		public override function hasEventListener(type:String):Boolean
		{
			return contentLoaderInfo.hasEventListener(type);
		}
		
		public override function willTrigger(type:String):Boolean
		{
			return contentLoaderInfo.willTrigger(type);
		}
		
	}
}
